{{extend ('./layout.html')}}

{{#block ("body")}}
{{extend ('./menu.html')}}
<div class="main-container">
	<div class="padding-md">
		<ul class="breadcrumb">
			<li><span class="primary-font"><i class="icon-home"></i></span><a href="index.html"> Home</a></li>
			<li>Table</li>
			<li>Datatable</li>
		</ul>
		{{#if(checkAction('userAdd'))}}
		<button onclick="location.href='/weekly/weeklyAdd';" type="button" class="btn btn-success btn-sm">添加班级</button>
		{{/if}}
		<table class="table table-striped" id="dataTable">
			<thead>
			<tr>
				<th>ID</th>
				<th>学生名字</th>
				<th>周记名称</th>
				<th>时间</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			{{#each(array)}}
			<tr>
				<td>{{this.weekly_id}}</td>
				<td>{{this.stu_name}}</td>
				<td>{{this.weekly_name}}</td>
				<td>{{this.weekly_time ? this.moment(this.weekly_time).format('YYYY-MM-DD') : "无创建时间"}}</td>
				<td>
					<a href="#" onclick="location.href='/weekly/weeklyEdit?weekly_id={{this.weekly_id}}'">编辑</a>
					<a href="#" onclick="Delete({{this.weekly_id}})">删除</a>
				</td>
			</tr>
			{{/each}}

			</tbody>
		</table>

		<ul class="pagination">

			<!--上翻页-->
			{{#if( page<=1 )}}
			<li class="disabled">
				<a>
					<span>&laquo;</span>
				</a>
			</li>
			{{else}}
			<li>
				<a href="/action/actionList?page={{page-1}}" aria-label="Previous">
					<span aria-hidden="true">&laquo;</span>
				</a>
			</li>
			{{/if}}

			<!--中间页码-->
			{{#each(totalPageArray)}}
			{{#if(page===this)}}
				<li  class="active"><a>{{this}}</a></li>
			{{else}}
				<li>
					<a href="/action/actionList?page={{this}}">{{this}}</a>
				</li>
			{{/if}}
			{{/each}}


			<!--下翻页-->
			{{#if(page >= totalPage)}}
			<li class="disabled">
				<a  aria-label="Next">
					<span aria-hidden="true">&raquo;</span>
				</a>
			</li>
			{{else}}
			<li>
				<a href="/action/actionList?page={{page+1}}" aria-label="Next">
					<span aria-hidden="true">&raquo;</span>
				</a>
			</li>
			{{/if}}



		</ul>
	</div><!-- ./padding-md -->
</div><!-- /main-container -->
<script>
	function Delete(delete_id)
	{
		if(delete_id)
		{
			if(confirm('是否确认删除?'))
			{
				location.href="/weekly/weeklyDelete?weekly_id="+delete_id;
				return false;
			}else{
				location.href="/weekly/weeklyList";
				return false;
			}
		}
	}
</script>
{{/block}}